package com.testing.month_exam_a;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by Administrator on 2017/3/1.
 */

public class Mybs extends BaseAdapter {


    Context context;
    List<Bean.RsBean.ChildrenBeanX.ChildrenBean> children;


    public Mybs(Context context, List<Bean.RsBean.ChildrenBeanX.ChildrenBean> children) {
        this.context = context;
        this.children = children;
    }

    @Override
    public int getCount() {
        return children.size();
    }

    @Override
    public Object getItem(int position) {
        return children.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        convertView = View.inflate(context, R.layout.grd_item, null);

        ImageView imim = (ImageView) convertView.findViewById(R.id.imim);

        TextView name = (TextView) convertView.findViewById(R.id.name);

        ImageLoader.getInstance().displayImage(children.get(position).imgApp, imim, MainActivity.op);

        name.setText(children.get(position).dirName);

        return convertView;
    }

}
